package com.itsu.mysql.service.impl;

import cn.hutool.crypto.SecureUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.itsu.interfaces.entity.HuanxinUser;
import com.itsu.interfaces.service.HuanxinUserService;
import com.itsu.mysql.mappers.HuanxinUserMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;
import java.util.Map;

@Service
public class HuanxinUserServiceImpl implements HuanxinUserService {

    @Autowired
    HuanxinUserMapper huanxinUserMapper;


    @Override
    public void addUser(HuanxinUser huanxinUser) {
        huanxinUserMapper.insert(huanxinUser);
    }

    @Override
    public Map<String, String> queryHuanXinUser(Long uid) {
        Map<String, String> map = new HashMap<>();
        HuanxinUser huanxinUser = huanxinUserMapper.selectOne(Wrappers.lambdaQuery(HuanxinUser.class).eq(HuanxinUser::getUserId, uid));
        map.put("username", huanxinUser.getUsername());
        map.put("password", huanxinUser.getPassword());
        return map;
    }
}
